<?php
include(CMS_PATH . 'utils/file_utils.php');
include('page_list_renderer.php');
?>

<?php echo $this->css('css/pages'); ?>

<table border="0" cellpadding="4" cellspacing="0" align="center" class="newsTbl">
    <?php if(!isset($_GET['add']) && !isset($_GET['edit']) && !isset($_GET['edit_home'])) { ?>
        <tr>
            <td class="newsHeader">                 
                <a id="add-page-link" href="<?php echo $this->url(array('action' => 'getParentPages')); ?>"><img src="images/icons/page_add.png" alt="add" width="16" height="16" border="0" align="absmiddle" /> Add New Page</a> 
                <a id="delete-selected-link" href="<?php echo $this->url(array('action' => 'deletePages')); ?>"><img src="images/icons/page_delete.png" alt="del" width="16" height="16" border="0" align="absmiddle" /> Delete Selected</a> 
            </td>
        </tr>
        <tr>
            <td class="newsContent">
                
                <div class="tree-instruction">Click To Collapse/Expand, Right Click for Options</div>
                
                <div class="cms-pages">
                    <!--<div class="cms-list-header">
                        <div class="page-name-col">
                            <input type="checkbox" id="checkall" name="item" value="" />
                            Page Name </div>
                        <div class="options-col">Options</div>
                    </div>
                    <div class="home-page-block">
                        <div class="page-name-col"> <a class="edit-home-link" href="<?php echo $this->url(array('action' => 'edit_home')); ?>"><img src="images/icons/page_white_code.png" alt="home" width="16" height="16" border="0" align="absmiddle" /> Home Page Text</a> </div>
                        <div class="options-col"> <a class="edit-home-link" href="<?php echo $this->url(array('action' => 'edit_home')); ?>"><img src="images/icons/page_white_code.png" alt="edit" width="16" height="16" border="0" align="absmiddle" /> Edit Block</a> &nbsp; <img src="images/icons/house_go.png" alt="prev" width="16" height="16" border="0" align="absmiddle" /> <a href="<?php echo $site->getHomePageURL(); ?>" target="_blank">Preview</a> </div>
                    </div>-->
                    <div class="pages-block">
                        <!--<div class="tree-instruction">Click To Collapse/Expand, Right Click for Options</div>-->
                        <ul id="cms-page-list" class='cms-page-list'>
                            <?php listPages($this, $pages); ?>
                        </ul>
                    </div>

                    <div class="display-block">
                        <!--<div class="tree-instruction">Content of Page Will Be Displayed Here</div>-->
                        <div class="editor-block">
                            <!--<div class="cms-content-header">Add / Edit Page</div>-->
                            <div  id="editor-content">
                                <?php include("pages_form.php"); ?>
                            </div>
                        </div>
                    </div>
                    <!--<div class="footer-block">
                        <div class="page-name-col"> <a class="edit-footer-link" href="<?php echo $this->url(array('action' => 'edit_footer')); ?>"><img src="images/icons/page_white_code.png" alt="home" width="16" height="16" border="0" align="absmiddle" /> Footer Text</a> </div>
                        <div class="options-col"> <a class="edit-footer-link" href="<?php echo $this->url(array('action' => 'edit_footer')); ?>"><img src="images/icons/page_white_code.png" alt="edit" width="16" height="16" border="0" align="absmiddle" /> Edit Block</a> </div>
                    </div>-->
                </div>
            </td>
        </tr>
    <?php } ?>
</table>

<?php echo $this->script('js/pages.js'); ?> 
<script type="text/javascript">
    pageManager.addLoadEvent(function() {
        pages.setSiteIdentifier('<?php echo $_SESSION['SiteIdentifier']; ?>');
        pages.init();
    });
</script> 

<!-- delay page specific library loading to improve page load performance --> 
<script type="text/javascript" src="scripts/tiny_mce/tiny_mce.js"></script> 
<script type="text/javascript" src="scripts/friendurl/jquery.friendurl.min.js"></script>
<?php $fileUtils->printScripts(); ?>